import os
from dotenv import load_dotenv

load_dotenv()  # Load environment variables from .env file

# API Keys
DEEPSEEK_API_KEY = os.getenv("DEEPSEEK_API_KEY")
IMAGE_GEN_API_KEY = os.getenv("IMAGE_GEN_API_KEY")  # For Stability AI or similar

# Model Configuration
LLM_MODEL = "deepseek-chat"
IMAGE_MODEL = "stable-diffusion-xl"

# CLIP Configuration
CLIP_MODEL = "ViT-B/32"

# Application Settings
TEMP_DIR = "temp"
OUTPUT_DIR = "output"
MAX_ITERATIONS = 3

# Style Templates
STYLE_TEMPLATES = {
    "minimalist": "Clean, simple layout with ample white space, sans-serif fonts, and subtle color accents",
    "academic": "Formal structure with clear sections, serif fonts, and university/institution branding",
    "modern": "Bold colors, dynamic layouts, geometric shapes, and contemporary typography",
    "technical": "Data-focused with prominent charts, diagrams, and structured information hierarchy",
    "creative": "Unique layouts, artistic elements, custom illustrations, and expressive typography"
}

os.makedirs(TEMP_DIR, exist_ok=True)
os.makedirs(OUTPUT_DIR, exist_ok=True)

#CONTENT_WEIGHT = 0.5  # 内容相关性的权重
#STYLE_WEIGHT = 0.5    # 风格对齐度的权重

# 最小对齐度阈值
MIN_STYLE_ALIGNMENT_SCORE = 25.0

# 项目根目录
BASE_DIR = os.path.dirname(os.path.abspath(__file__))

# 静态文件目录
STATIC_DIR = os.path.join(BASE_DIR, "static")

# 确保目录存在
if not os.path.exists(STATIC_DIR):
    os.makedirs(STATIC_DIR)
    
# 确保images目录存在
IMAGES_DIR = os.path.join(STATIC_DIR, "images")
if not os.path.exists(IMAGES_DIR):
    os.makedirs(IMAGES_DIR)